package com.second.controller;

import com.second.websocket.WebSocketProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping()
public class websocketTest {

    @Autowired
    private WebSocketProcess webSocketProcess;

    @GetMapping("test/{id}/{msg}")
    public String all(@PathVariable("id") long id, @PathVariable("msg") String msg) {
        try {
            webSocketProcess.sendMessage(id, msg);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "私发成功！";
    }
}
